from conftest import login_token2
from ApiBase import ApiBase
import pytest,requests,os


class Test_hotNews():
    def test_hotNews_01(self, login_token2):
        """收藏新闻"""
        userId, token = login_token2
        # 请求地址
        url = 'http://10.59.9.18/hotNews/news/verify/v1/collectNews'
        # 请求头
        headers = {
            'userId': str(userId),
            'token': str(token)
        }
        # 请求体
        data = {
            'newsId': 1
        }
        # 发送post请求
        r = requests.put(url=url, params=data, headers=headers)
        r_json = r.json()
        print(r_json)

    def test_hotNews_02(self, login_token2):
        """取消收藏新闻"""
        userId, token = login_token2
        # 请求地址
        url = 'http://10.59.9.18/hotNews/news/verify/v1/cancelCollectNews'
        # 请求头
        headers = {
            'userId': str(userId),
            'token': str(token)
        }
        # 请求体
        data = {
            'newsId': 1
        }
        # 发送post请求
        r = requests.delete(url=url, params=data, headers=headers)
        r_json = r.json()
        print(r_json)